<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>支付</title>
</head>

<body>
	<div style="font-size: 10em;">正在支付</div>
	<script type="text/javascript">
		function onBridgeReady() {
			var p = {
				"appId" : "${appId}",
				"timeStamp" : "${timeStamp}",
				"nonceStr" : "${nonceStr}",
				"package" : "${packageStr}",
				"signType" : "${signType}",
				"paySign" : "${paySign}"
			};
			WeixinJSBridge.invoke('getBrandWCPayRequest', p, function(res) {
				if (res.err_msg == "get_brand_wcpay_request：ok") {
					alert(res.err_msg);
				} // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
				else {
					alert(res.err_msg);
				}
			});
		}
		if (typeof WeixinJSBridge == "undefined") {
			if (document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
						false);
			} else if (document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
			alert(typeof WeixinJSBridge);
		} else {
			onBridgeReady();
		}
	</script>
</body>
</html>
